//
//  AIVipMonView.m
//  Mia
//
//  Created by Vill on 2024/1/5.
//

#import "AIVipMonView.h"

@interface AIVipMonView ()

@property (nonatomic, strong) UILabel *leftLbl;  //左边文本
@property (nonatomic, strong) UILabel *moneyLbl; //金额
@property (nonatomic, strong) UILabel *perLbl;   //每月价格

@end

@implementation AIVipMonView

- (instancetype)initWithFrame:(CGRect)frame{
    if(self == [super initWithFrame:frame]){
        [self setupUI];
    }
    return self;
}

- (void)setupUI{
    [self addSubview:self.bgView];
    [self.bgView addSubview:self.leftLbl];
    [self.bgView addSubview:self.perLbl];
    [self.bgView addSubview:self.moneyLbl];
    [self.bgView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.mas_equalTo(self);
    }];
    [self.leftLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.mas_equalTo(PTW(50));
        make.bottom.mas_equalTo(self.bgView.mas_centerY).mas_offset(PTW(5));
    }];
    [self.perLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerX.mas_equalTo(self.leftLbl);
        make.top.mas_equalTo(self.leftLbl.mas_bottom);
    }];
    [self.moneyLbl mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.bgView);
        make.trailing.mas_equalTo(self.bgView).mas_offset(-PTW(45));
    }];
}

- (UIView *)bgView{
    if(!_bgView){
        _bgView = [UIView new];
        _bgView.backgroundColor = [UIColor colorHex:@"#FFFFFF" alpha:0.3];
        _bgView.layer.cornerRadius = PTW(15);
        _bgView.layer.borderColor = UIColor.clearColor.CGColor;
        _bgView.layer.borderWidth = PTW(2);
    }
    return _bgView;
}

- (UILabel *)leftLbl{
    if(!_leftLbl){
        _leftLbl = [UILabel new];
        _leftLbl.text = @"1 Month";
        _leftLbl.font = [UIFont fontWithWeight:MTBold size:PTW(22)];
        _leftLbl.textColor = UIColor.whiteColor;
    }
    return _leftLbl;
}

- (UILabel *)perLbl{
    if(!_perLbl){
        _perLbl = [UILabel new];
        _perLbl.text = @"$19.99/Mo";
        _perLbl.font = [UIFont fontWithWeight:MTBold size:PTW(12)];
        _perLbl.textColor = [UIColor colorHex:@"#33FFC1"];
    }
    return _perLbl;
}

- (UILabel *)moneyLbl{
    if(!_moneyLbl){
        _moneyLbl = [UILabel new];
        _moneyLbl.text = @"$19.99";
        _moneyLbl.font = [UIFont fontWithWeight:Medium size:PTW(22)];
        _moneyLbl.textColor = UIColor.whiteColor;
    }
    return _moneyLbl;
}

@end
